<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理员后台 - 在线影院订票系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <style>
        .admin-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 3rem 0;
        }
        .feature-card {
            border: none;
            border-radius: 15px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            height: 100%;
        }
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        }
        .feature-icon {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2rem;
            margin: 0 auto 1rem;
        }
        .icon-movies { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
        .icon-showtimes { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); color: white; }
        .icon-statistics { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); color: white; }
        .icon-settings { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); color: white; }
        
        .quick-stats {
            background: white;
            border-radius: 15px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            padding: 2rem;
            margin-bottom: 2rem;
        }
        .stat-item {
            text-align: center;
            padding: 1rem;
        }
        .stat-number {
            font-size: 2rem;
            font-weight: bold;
            color: #667eea;
        }
        .stat-label {
            color: #666;
            font-size: 0.9rem;
        }
    </style>
</head>
<body class="bg-light">
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);">
        <div class="container">
            <a class="navbar-brand fw-bold" href="${pageContext.request.contextPath}/admin/">
                <i class="fas fa-cog me-2"></i>管理员后台
            </a>
            
            <div class="navbar-nav ms-auto">
                <!-- 主要管理功能 -->
                <a class="nav-link" href="${pageContext.request.contextPath}/admin/movies">
                    <i class="fas fa-film me-1"></i>电影管理
                </a>
                <a class="nav-link" href="${pageContext.request.contextPath}/admin/showtimes">
                    <i class="fas fa-calendar-alt me-1"></i>场次管理
                </a>
                <a class="nav-link" href="${pageContext.request.contextPath}/movies">
                    <i class="fas fa-home me-1"></i>前台首页
                </a>
                
                <!-- 用户菜单 -->
                <div class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                        <i class="fas fa-user me-1"></i>${sessionScope.user.username}
                    </a>
                    <ul class="dropdown-menu">
                        <li><a class="dropdown-item" href="${pageContext.request.contextPath}/admin/statistics">
                            <i class="fas fa-chart-bar me-2"></i>统计报表
                        </a></li>
                        <li><hr class="dropdown-divider"></li>
                        <li><a class="dropdown-item" href="${pageContext.request.contextPath}/logout">
                            <i class="fas fa-sign-out-alt me-2"></i>退出登录
                        </a></li>
                    </ul>
                </div>
            </div>
        </div>
    </nav>

    <!-- 管理员头部 -->
    <section class="admin-header">
        <div class="container">
            <div class="row align-items-center">
                <div class="col-md-8">
                    <h1><i class="fas fa-tachometer-alt me-3"></i>管理员控制台</h1>
                    <p class="lead mb-0">欢迎回来，${sessionScope.user.username}！管理您的影院系统</p>
                </div>
                <div class="col-md-4 text-end">
                    <div class="text-white-50">
                        <i class="fas fa-clock me-2"></i>
                        <span id="currentTime"></span>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <div class="container mt-4">
        <!-- 快速统计 -->
        <div class="quick-stats">
            <h5 class="mb-3"><i class="fas fa-chart-line me-2"></i>系统概览</h5>
            <div class="row">
                <div class="col-md-3">
                    <div class="stat-item">
                        <div class="stat-number">--</div>
                        <div class="stat-label">总电影数</div>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="stat-item">
                        <div class="stat-number">--</div>
                        <div class="stat-label">今日场次</div>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="stat-item">
                        <div class="stat-number">--</div>
                        <div class="stat-label">今日订单</div>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="stat-item">
                        <div class="stat-number">--</div>
                        <div class="stat-label">注册用户</div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 管理功能 -->
        <h5 class="mb-4"><i class="fas fa-tools me-2"></i>管理功能</h5>
        <div class="row">
            <!-- 电影管理 -->
            <div class="col-lg-3 col-md-6 mb-4">
                <div class="card feature-card">
                    <div class="card-body text-center p-4">
                        <div class="feature-icon icon-movies">
                            <i class="fas fa-film"></i>
                        </div>
                        <h5 class="card-title">电影管理</h5>
                        <p class="card-text text-muted">添加、编辑和管理电影信息，设置电影状态</p>
                        <div class="d-grid gap-2">
                            <a href="${pageContext.request.contextPath}/admin/movies" class="btn btn-primary">
                                <i class="fas fa-arrow-right me-2"></i>进入管理
                            </a>
                            <a href="${pageContext.request.contextPath}/admin/movies?action=add" class="btn btn-outline-primary btn-sm">
                                <i class="fas fa-plus me-1"></i>添加电影
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 场次管理 -->
            <div class="col-lg-3 col-md-6 mb-4">
                <div class="card feature-card">
                    <div class="card-body text-center p-4">
                        <div class="feature-icon icon-showtimes">
                            <i class="fas fa-calendar-alt"></i>
                        </div>
                        <h5 class="card-title">场次管理</h5>
                        <p class="card-text text-muted">安排电影放映场次，设置时间和票价</p>
                        <div class="d-grid gap-2">
                            <a href="${pageContext.request.contextPath}/admin/showtimes" class="btn btn-primary">
                                <i class="fas fa-arrow-right me-2"></i>进入管理
                            </a>
                            <a href="${pageContext.request.contextPath}/admin/showtimes?action=add" class="btn btn-outline-primary btn-sm">
                                <i class="fas fa-plus me-1"></i>添加场次
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 统计报表 -->
            <div class="col-lg-3 col-md-6 mb-4">
                <div class="card feature-card">
                    <div class="card-body text-center p-4">
                        <div class="feature-icon icon-statistics">
                            <i class="fas fa-chart-bar"></i>
                        </div>
                        <h5 class="card-title">统计报表</h5>
                        <p class="card-text text-muted">查看销售数据和系统运营统计</p>
                        <div class="d-grid">
                            <a href="${pageContext.request.contextPath}/admin/statistics" class="btn btn-primary">
                                <i class="fas fa-arrow-right me-2"></i>查看报表
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 系统设置 -->
            <div class="col-lg-3 col-md-6 mb-4">
                <div class="card feature-card">
                    <div class="card-body text-center p-4">
                        <div class="feature-icon icon-settings">
                            <i class="fas fa-cogs"></i>
                        </div>
                        <h5 class="card-title">系统设置</h5>
                        <p class="card-text text-muted">系统配置和用户管理功能</p>
                        <div class="d-grid">
                            <a href="#" class="btn btn-primary disabled">
                                <i class="fas fa-arrow-right me-2"></i>敬请期待
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 快速操作 -->
        <div class="row mt-4">
            <div class="col-md-12">
                <div class="alert alert-primary">
                    <h6><i class="fas fa-rocket me-2"></i>快速开始</h6>
                    <p class="mb-3">新手指南：</p>
                    <ol class="mb-0">
                        <li>首先在<strong>电影管理</strong>中添加电影信息</li>
                        <li>然后在<strong>场次管理</strong>中为电影安排放映场次</li>
                        <li>用户就可以在前台看到电影并进行订票了</li>
                    </ol>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 显示当前时间
        function updateTime() {
            const now = new Date();
            const timeString = now.toLocaleString('zh-CN', {
                year: 'numeric',
                month: '2-digit',
                day: '2-digit',
                hour: '2-digit',
                minute: '2-digit',
                second: '2-digit'
            });
            document.getElementById('currentTime').textContent = timeString;
        }
        
        updateTime();
        setInterval(updateTime, 1000);
    </script>
</body>
</html>
